float ScreenWidth;
float ScreenHeight;
void DepthPeelPS(float4 oPosZ	: TEXCOORD0,
				float4 oNorm	: TEXCOORD1,
				float2 Tex		: VPOS,
				out float4 ooPos	: COLOR0 )
{
	Tex.x /= ScreenWidth;
	Tex.y /= ScreenHeight;
	float zBef = tex2D(g_samSrcColor, Tex).z;

	float threshold = SilThreshold*(1.0f-zBef);

	float zNow = oPosZ.z/oPosZ.w;

	if(zNow-zBef<threshold)	clip(-1);
	ooPos = float4(oNorm.x/oNorm.w, -oNorm.y/oNorm.w, zNow, oNorm.z/oNorm.w);
	//ooPos = float4(oPosZ.z/oPosZ.w, oPosZ.z/oPosZ.w, oPosZ.z/oPosZ.w, oNorm.z/oNorm.w);
	//ooPos = float4(zBef, zBef, zBef,0);
}

technique DepthPeel
{
	pass p0
	{
		VertexShader = compile vs_2_0 RenderSceneVS();
		PixelShader  = compile ps_3_0 DepthPeelPS();
		ZEnable = true;
	}
}